

package cn.shengchao.base.event;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.RandomStringUtils;

import java.util.Date;
import java.util.List;

public class PayRefundMessageEvent extends BaseEvent<PayRefundMessageEvent.PayRefundMessage> {

    public PayRefundMessageEvent(Object source) {
        super(source);
        this.buildEventMessage((PayRefundMessageEvent.PayRefundMessage) source);
    }

    @Override
    public EventMessage<PayRefundMessage> buildEventMessage(PayRefundMessage data) {
        return EventMessage.<PayRefundMessageEvent.PayRefundMessage>builder()
                .id(RandomStringUtils.randomNumeric(11))
                .timestamp(new Date())
                .data(data)
                .build();
    }

    @Override
    public String topic() {
        return "pay_refund";
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class PayRefundMessage {
        private Long userId;
        private Long productId;
        private List<Long> orderItemIds;
        private Long orderId;
    }
}
